class Person(object):

    def run(self):
        print("我是跑的功能")

    def eat(self, food):
        print("吃得东西是：" + food)

    def say(self):
        print("hello %s, you is %d years old" % (self.name, self.age))

    # 初始换构造器里面有的 参数 既是对象的属性 self.name 是self对应的对象创建的属性
    def __init__(self, name, age, height):
        self.name = name
        self.age = age
        self.height = height

    def __del__(self):
        print("这是析构函数")

    # 相当于 java里面的toString方法
    def __str__(self):
        return "person(name: %s, age: %d, height: %d)" % (self.name, self.age, self.height)



per2 = Person("zs", 18, 160)
print(per2)
per2.say()

# 释放对象
# del per2
# NameError: name 'per2' is not defined
print(per2.name, per2.age)
